// main.js
import Vue from 'vue'
import App from './App.vue'
import { createStore } from '@/store'
import { createRouter } from './router'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import '@/assets/css/base.css'
import { ell } from '@/filters'
import cookie from '@/lib/auth'
Vue.prototype.cookie = cookie
Vue.use(ElementUI)
Vue.filter('ell', ell)

// 导出一个工厂函数，用于创建新的
// 应用程序、router 和 store 实例
export function createApp() {
  const router = createRouter()
  const store = createStore()
  const app = new Vue({
    router,
    store,
    // 根实例简单的渲染应用程序组件。
    render: h => h(App)
  })
  return { app, router, store }
}
